<% if @error %>
  $('#float-alert p').html("<%= escape_javascript(@error) %>");
<% elsif @namespace.errors.any? %>
  $('#float-alert p').html("<%= escape_javascript(@namespace.errors.full_messages.join('<br/>')) %>");
<% else %>
  $('#float-alert p').html("Namespace '<%= escape_javascript(@namespace.name) %>' was created successfully");

  $('#add_namespace_form').fadeOut();
  $('#add_namespace_btn i').addClass("fa-chevron-down")
  $('#add_namespace_btn i').removeClass("fa-chevron-up")

  // Check on which page we are creating the namespace.
  if ($('#namespaces').length > 0) {
    $("<%= escape_javascript(render @namespace) %>").appendTo("#namespaces");
  } else {
    <% if @namespaces.include? @namespace %>
      $("<%= escape_javascript(render @namespace) %>").appendTo("#accessible-namespaces");
    <% end %>
  }
<% end %>
$('#float-alert').fadeIn(setTimeOutAlertDelay());
